package oop3;

public class Dog {
	private String name = "豆豆";
	private int health;

	private Dog(String m) {
		setName(m);
	}

	public Dog(String m, int h) {
		this(m);
		setHealth(h);
	}

	private void setName(String n) {
		name = n;
	}

	public int getHealth() {
		return health;
	}

	public void setHealth(int health) {
		if (health < 0) {
			System.out.println("这个健康值" + health + "不合适");
			health = 10;
		}

		this.health = health;
	}

	//
	public void show() {
		System.out.println("狗的名字叫" + name + ",健康值是" + this.health);
	}
}
